package com.heima.freemarker;

import com.heima.file.service.FileStorageService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.io.FileInputStream;

@SpringBootTest(classes = FreemarkerApp.class)
@RunWith(SpringRunner.class)
public class MinIOTest2 {

    @Autowired
    private FileStorageService fileStorageService;

    @Test
    public void testUpload() throws Exception {
        FileInputStream fileInputStream = new FileInputStream("d:\\index.html");
        String path = fileStorageService.uploadHtmlFile("", "list.html", fileInputStream);
        System.out.println(path);
    }

    @Test
    public void testDel(){
        fileStorageService.delete("http://8.137.100.17:9000/leadnews/2021/10/09/list.html");
    }

}